<template>
  <div class="wait_allot">
    <dt-search ref="search" :labelWidth="100" :xl=8>
      <Button type="success" v-if="unlocking('0213030307')"
        @click="exportExcel()">导出Excel</Button>
    </dt-search>
    <dt-grid ref="table" page :onFetch='onFetch' :select='select' />
  </div>
</template>

<script>
  import columnOpt from '../opt/detailColumns'
  import clueImportMgr from '@/biz/customer/clueImport'
  import searchOpt from '../opt/detailSearch'

  export default {
    components: {},
    data() {
      return {
        name: 'rejected_Allot',
        select: {
          change: (e) => { this.tableChange(e) },
        },
        selectData: [],
        choosedLength: 0,
        info: {
          companyIds: [],
          buildingId: ''
        },
        filterParams: {}
      }
    },
    methods: {
      exportExcel() {
        let params = this.filterParams
        clueImportMgr.downloadOperationDetailList(params)
      },
      // 清空筛选条件
      onReset() {
        this.$refs.search.init(this.$refs.table, new searchOpt(this), this.info)
      },
      onFetch(data) {
        let params = {
          ...data,
          batchId: Number(this.$route.query.batchId),
          type: 2
        }
        this.filterParams = params
        return clueImportMgr.getOperationDetailList(params).then(res => {
          this.totalNum = res.total
          res.list = res.records
          return res
        })
      },
    },
    mounted() {
      this.$refs.table.init(this, new columnOpt.ColumnAllot(this))
      this.$refs.search.init(this.$refs.table, new searchOpt(this), this.info)
      this.$refs.table.fetch()
    }
  }
</script>

<style lang="scss" scoped>
  .wait_allot {
    .flex_btn {
      button {
        margin-left: 10px;
      }
    }
  }
</style>